public class demo {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            for (int i = 0; i < 1; i++) {

            }
        },"t1");
        System.out.println(t.getName()+" : "+t.getState());
        t.start();
        while(t.isAlive()){
            System.out.println(t.getName()+ " : "+t.getState());
        }
        System.out.println(t.getName()+ " : "+t.getState());

    }
}
